<template>
  <div class="item-content">
    <div class="form-content" style="margin-bottom: 20px">
      <div class="item-header">
        <div class="subheading">个人的培训和学习档案</div>
        <div class="search-container">
          <el-input
            placeholder="请输入查询信息"
            size="medium"
            class="item-filter-width"
            v-model="searchValue"
          >
            <el-button
              slot="append"
              type="primary"
              icon="el-icon-search"
              @click="search"
            >
              搜索
            </el-button>
          </el-input>
        </div>
      </div>
      <!-- 表格展示 -->
      <div>
        <el-table height="600" :data="personalTableData" border>
          <template #empty>
            <el-empty v-show="!personalTableData.length" description="暂无数据">
            </el-empty>
          </template>

          <el-table-column prop="trainesses.name" label="姓名" width="180">
          </el-table-column>
          <el-table-column prop="trainesses.post" label="岗位" width="180">
          </el-table-column
          ><el-table-column prop="trainesses.post" label="培训类别" width="180">
          </el-table-column>
          <el-table-column
            prop="businessProfiles.trainingStudy"
            label="培训名称"
          >
          </el-table-column>
          <el-table-column
            prop="businessProfiles.content"
            label="培训或学习内容"
          >
          </el-table-column>
          <el-table-column prop="businessProfiles.lesson" label="课时">
          </el-table-column>
          <el-table-column prop="trainesses.result" label="考核结果">
          </el-table-column>
          <el-table-column prop="trainesses.qualified" label="是否合格">
            <template #default="{ row }">
              <div v-show="row.trainesses?.qualified == 1">合格</div>
              <div v-show="row.trainesses?.qualified == 0">不合格</div>
            </template>
          </el-table-column>
          <el-table-column prop="businessProfiles.time" label="培训时间">
            <template #default="{ row }">
              <div v-show="row.businessProfiles != null">
                {{ new Date(row.businessProfiles?.time).toLocaleString() }}
              </div>
            </template>
          </el-table-column>
          <!-- 
          <el-table-column width="180" label="操作">
            <template #default="{ row }">
              <el-popconfirm
                style="margin-right: 10px"
                title="确定删除吗？"
                @confirm="deleteRow(row.id)"
              >
                <el-button slot="reference" type="danger" size="large"
                  >删除</el-button
                >
              </el-popconfirm>
              <el-button type="primary" size="large" @click="editRow(row.id)"
                >编辑</el-button
              >
            </template>
          </el-table-column> -->
        </el-table>
      </div>
    </div>
    <div
      style="
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
      "
    >
      <!-- <el-pagination
        :current-page="1"
        :page-sizes="[10, 15, 50, 100, 200, 300, 400, 1000]"
        :page-size="5"
        layout="total, sizes, prev, pager, next, jumper"
        :total="1000"
      >
      </el-pagination> -->
    </div>
  </div>
</template>

<script setup>
import { getpersonalProfile } from "@/api/personalProfile";
import { ref } from "vue";
import { Notification } from "element-ui";

const searchValue = ref(null);
const search = async () => {
  let result = await getpersonalProfile(searchValue.value);
  if (result?.code == 0) {
    Notification({
      title: "成功",
      message: "查询成功",
      type: "success",
    });
    personalTableData.value = result.data;
    console.log(result);
  } else {
    Notification({
      title: "失败",
      message: "未查到此人",
      type: "error",
    });
  }
};
const personalTableData = ref([]);
</script>

<style lang="scss" scoped>
// :deep(.cell) {
//   display: flex;
//   justify-content: space-around;
// }
:deep(.el-icon-arrow-right:before) {
  font-size: 12px !important;
}
:deep(.el-table th) {
  background: #fafafa;
}
:deep(.el-collapse-item__header) {
  font-weight: bold;
  color: #333;
  font-size: 15px;
  padding: 0 10px;
}
:deep(.el-icon-arrow-right:before) {
  font-weight: bold;
  color: #333;
  font-size: 25px;
}
body {
  min-height: 100vh;

  transition: all 0.3s ease;
}
.container {
  height: 100%;
  padding: 15px;
  overflow: auto;
  box-sizing: border-box;

  .main-content {
    background-color: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    min-width: 700px;

    .header-container {
      padding: 15px 15px;
      border-bottom: solid 1px #e6e6e6;
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      .title {
        position: relative;
        font-weight: bold;
        color: #333;
        font-size: 15px;
        padding-left: 16px;

        &::before {
          content: "";
          width: 3px;
          height: 16px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 8px);
          position: absolute;
        }

        &::after {
          content: "";
          width: 3px;
          height: 16px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 8px);
          position: absolute;
        }
      }
    }
  }
}

.main {
  padding: 12px 15px;

  .item-content {
    height: 100%;
    overflow: hidden;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;

    .item-header {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;

      .subheading {
        position: relative;
        color: #555;
        font-size: 14px;
        padding-left: 14px;

        &::after {
          content: "";
          width: 2px;
          height: 14px;
          background-color: #82a848;
          left: 0;
          top: calc(50% - 7px);
          position: absolute;
        }

        &::before {
          content: "";
          width: 2px;
          height: 14px;
          background-color: #82a848;
          left: 4px;
          top: calc(50% - 7px);
          position: absolute;
        }
      }
    }

    .content-container {
      margin-top: -1px;
    }
  }
}

.w-100 {
  width: 100%;
}

.item-form-content {
  display: flex;
  flex-direction: row;
  align-items: center;

  i {
    margin: 0 10px;
  }
}

.productList-content {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  height: 40px;
}

.form-content {
  padding: 0 10px;
}

.dialog-action-bar {
  text-align: center;
  margin-top: 30px;
}
</style>
